package com.ibm.risk.irmp.workflow.client.flowable.api;

import com.ibm.risk.irmp.workflow.client.flowable.ApiClient;

import com.ibm.risk.irmp.workflow.client.flowable.model.DataResponseHistoricTaskInstanceResponse;
import com.ibm.risk.irmp.workflow.client.flowable.model.DataResponseHistoricTaskLogEntryResponse;
import com.ibm.risk.irmp.workflow.client.flowable.model.HistoricIdentityLinkResponse;
import com.ibm.risk.irmp.workflow.client.flowable.model.HistoricTaskInstanceQueryRequest;
import com.ibm.risk.irmp.workflow.client.flowable.model.HistoricTaskInstanceResponse;
import java.time.OffsetDateTime;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.util.UriComponentsBuilder;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;


@Component("com.ibm.risk.irmp.flowable.api.HistoryTaskApi")
public class HistoryTaskApi {
    private ApiClient apiClient;

    public HistoryTaskApi() {
        this(new ApiClient());
    }

    @Autowired
    public HistoryTaskApi(ApiClient apiClient) {
        this.apiClient = apiClient;
    }

    public ApiClient getApiClient() {
        return apiClient;
    }

    public void setApiClient(ApiClient apiClient) {
        this.apiClient = apiClient;
    }

    /**
     * Delete a historic task instance
     *
     * <p><b>204</b> - Indicates that the historic task instance was deleted.
     * <p><b>404</b> - Indicates that the historic task instance could not be found.
     * @param taskId The taskId parameter
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public void deleteTaskInstance(String taskId) throws RestClientException {
        Object postBody = null;

        // verify the required parameter 'taskId' is set
        if (taskId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'taskId' when calling deleteTaskInstance");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("taskId", taskId);
        String path = UriComponentsBuilder.fromPath("/history/historic-task-instances/{taskId}").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = { };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
        apiClient.invokeAPI(path, HttpMethod.DELETE, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * Get a historic task instance form
     *
     * <p><b>200</b> - Indicates request was successful and the task form is returned
     * <p><b>404</b> - Indicates the requested task was not found.
     * @param taskId The taskId parameter
     * @return String
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public String getHistoricTaskForm(String taskId) throws RestClientException {
        Object postBody = null;

        // verify the required parameter 'taskId' is set
        if (taskId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'taskId' when calling getHistoricTaskForm");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("taskId", taskId);
        String path = UriComponentsBuilder.fromPath("/history/historic-task-instances/{taskId}/form").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = {
            "application/json"
        };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<String> returnType = new ParameterizedTypeReference<String>() {};
        return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * List historic task log entries
     *
     * <p><b>200</b> - Indicates that historic task log entries could be queried.
     * <p><b>404</b> - Indicates an parameter was passed in the wrong format. The status-message contains additional information.
     * @param taskId An id of the historic task instance.
     * @param type The type of the log entry.
     * @param userId The user who produced the task change.
     * @param processInstanceId The process instance id of the historic task log entry.
     * @param processDefinitionId The process definition id of the historic task log entry.
     * @param scopeId Only return historic task log entries with the given scopeId.
     * @param scopeDefinitionId Only return historic task log entries with the given scopeDefinitionId.
     * @param subScopeId Only return historic task log entries with the given subScopeId
     * @param scopeType Only return historic task log entries with the given scopeType.
     * @param from Return task log entries starting from a date.
     * @param to Return task log entries up to a date.
     * @param tenantId Only return historic task log entries with the given tenantId.
     * @param fromLogNumber Return task log entries starting from a log number
     * @param toLogNumber Return task log entries up to specific a log number
     * @return DataResponseHistoricTaskLogEntryResponse
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public DataResponseHistoricTaskLogEntryResponse getHistoricTaskLogEntries(String taskId, String type, String userId, String processInstanceId, String processDefinitionId, String scopeId, String scopeDefinitionId, String subScopeId, String scopeType, OffsetDateTime from, OffsetDateTime to, String tenantId, String fromLogNumber, String toLogNumber) throws RestClientException {
        Object postBody = null;

        String path = UriComponentsBuilder.fromPath("/history/historic-task-log-entries").build().toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "taskId", taskId));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "type", type));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "userId", userId));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "processInstanceId", processInstanceId));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "processDefinitionId", processDefinitionId));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "scopeId", scopeId));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "scopeDefinitionId", scopeDefinitionId));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "subScopeId", subScopeId));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "scopeType", scopeType));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "from", from));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "to", to));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "tenantId", tenantId));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "fromLogNumber", fromLogNumber));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "toLogNumber", toLogNumber));

        final String[] accepts = {
            "application/json"
        };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<DataResponseHistoricTaskLogEntryResponse> returnType = new ParameterizedTypeReference<DataResponseHistoricTaskLogEntryResponse>() {};
        return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * Get a single historic task instance
     *
     * <p><b>200</b> - Indicates that the historic task instances could be found.
     * <p><b>404</b> - Indicates that the historic task instances could not be found.
     * @param taskId The taskId parameter
     * @return HistoricTaskInstanceResponse
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public HistoricTaskInstanceResponse getTaskInstance(String taskId) throws RestClientException {
        Object postBody = null;

        // verify the required parameter 'taskId' is set
        if (taskId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'taskId' when calling getTaskInstance");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("taskId", taskId);
        String path = UriComponentsBuilder.fromPath("/history/historic-task-instances/{taskId}").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = {
            "application/json"
        };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<HistoricTaskInstanceResponse> returnType = new ParameterizedTypeReference<HistoricTaskInstanceResponse>() {};
        return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * List identity links of a historic task instance
     *
     * <p><b>200</b> - Indicates request was successful and the identity links are returned
     * <p><b>404</b> - Indicates the task instance could not be found.
     * @param taskId The taskId parameter
     * @return List&lt;HistoricIdentityLinkResponse&gt;
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public List<HistoricIdentityLinkResponse> listHistoricTaskInstanceIdentityLinks(String taskId) throws RestClientException {
        Object postBody = null;

        // verify the required parameter 'taskId' is set
        if (taskId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'taskId' when calling listHistoricTaskInstanceIdentityLinks");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("taskId", taskId);
        String path = UriComponentsBuilder.fromPath("/history/historic-task-instances/{taskId}/identitylinks").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = {
            "application/json"
        };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<List<HistoricIdentityLinkResponse>> returnType = new ParameterizedTypeReference<List<HistoricIdentityLinkResponse>>() {};
        return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * List historic task instances
     *
     * <p><b>200</b> - Indicates that historic task instances could be queried.
     * <p><b>404</b> - Indicates an parameter was passed in the wrong format. The status-message contains additional information.
     * @param taskId An id of the historic task instance.
     * @param processInstanceId The process instance id of the historic task instance.
     * @param processInstanceIdWithChildren Selects the historic task instances for the process instance and its children.
     * @param processDefinitionKey The process definition key of the historic task instance.
     * @param processDefinitionKeyLike The process definition key of the historic task instance, which matches the given value.
     * @param processDefinitionId The process definition id of the historic task instance.
     * @param processDefinitionName The process definition name of the historic task instance.
     * @param processDefinitionNameLike The process definition name of the historic task instance, which matches the given value.
     * @param processBusinessKey The process instance business key of the historic task instance.
     * @param processBusinessKeyLike The process instance business key of the historic task instance that matches the given value.
     * @param executionId The execution id of the historic task instance.
     * @param taskDefinitionKey The task definition key for tasks part of a process
     * @param taskDefinitionKeys The task definition key for tasks part of a process
     * @param taskName The task name of the historic task instance.
     * @param taskNameLike The task name with like operator for the historic task instance.
     * @param taskDescription The task description of the historic task instance.
     * @param taskDescriptionLike The task description with like operator for the historic task instance.
     * @param taskCategory Select tasks with the given category. Note that this is the task category, not the category of the process definition (namespace within the BPMN Xml).
     * @param taskDeleteReason The task delete reason of the historic task instance.
     * @param taskDeleteReasonLike The task delete reason with like operator for the historic task instance.
     * @param taskAssignee The assignee of the historic task instance.
     * @param taskAssigneeLike The assignee with like operator for the historic task instance.
     * @param taskOwner The owner of the historic task instance.
     * @param taskOwnerLike The owner with like operator for the historic task instance.
     * @param taskInvolvedUser An involved user of the historic task instance
     * @param taskPriority The priority of the historic task instance.
     * @param finished Indication if the historic task instance is finished.
     * @param processFinished Indication if the process instance of the historic task instance is finished.
     * @param parentTaskId An optional parent task id of the historic task instance.
     * @param dueDate Return only historic task instances that have a due date equal this date.
     * @param dueDateAfter Return only historic task instances that have a due date after this date.
     * @param dueDateBefore Return only historic task instances that have a due date before this date.
     * @param withoutDueDate Return only historic task instances that have no due-date. When false is provided as value, this parameter is ignored.
     * @param taskCompletedOn Return only historic task instances that have been completed on this date.
     * @param taskCompletedAfter Return only historic task instances that have been completed after this date.
     * @param taskCompletedBefore Return only historic task instances that have been completed before this date.
     * @param taskCreatedOn Return only historic task instances that were created on this date.
     * @param taskCreatedBefore Return only historic task instances that were created before this date.
     * @param taskCreatedAfter Return only historic task instances that were created after this date.
     * @param includeTaskLocalVariables An indication if the historic task instance local variables should be returned as well.
     * @param includeProcessVariables An indication if the historic task instance global variables should be returned as well.
     * @param scopeDefinitionId Only return historic task instances with the given scopeDefinitionId.
     * @param scopeId Only return historic task instances with the given scopeId.
     * @param scopeType Only return historic task instances with the given scopeType.
     * @param tenantId Only return historic task instances with the given tenantId.
     * @param tenantIdLike Only return historic task instances with a tenantId like the given value.
     * @param withoutTenantId If true, only returns historic task instances without a tenantId set. If false, the withoutTenantId parameter is ignored.
     * @return DataResponseHistoricTaskInstanceResponse
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public DataResponseHistoricTaskInstanceResponse listHistoricTaskInstances(String taskId, String processInstanceId, String processInstanceIdWithChildren, String processDefinitionKey, String processDefinitionKeyLike, String processDefinitionId, String processDefinitionName, String processDefinitionNameLike, String processBusinessKey, String processBusinessKeyLike, String executionId, String taskDefinitionKey, String taskDefinitionKeys, String taskName, String taskNameLike, String taskDescription, String taskDescriptionLike, String taskCategory, String taskDeleteReason, String taskDeleteReasonLike, String taskAssignee, String taskAssigneeLike, String taskOwner, String taskOwnerLike, String taskInvolvedUser, String taskPriority, Boolean finished, Boolean processFinished, String parentTaskId, OffsetDateTime dueDate, OffsetDateTime dueDateAfter, OffsetDateTime dueDateBefore, Boolean withoutDueDate, OffsetDateTime taskCompletedOn, OffsetDateTime taskCompletedAfter, OffsetDateTime taskCompletedBefore, OffsetDateTime taskCreatedOn, OffsetDateTime taskCreatedBefore, OffsetDateTime taskCreatedAfter, Boolean includeTaskLocalVariables, Boolean includeProcessVariables, String scopeDefinitionId, String scopeId, String scopeType, String tenantId, String tenantIdLike, Boolean withoutTenantId) throws RestClientException {
        Object postBody = null;

        String path = UriComponentsBuilder.fromPath("/history/historic-task-instances").build().toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "taskId", taskId));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "processInstanceId", processInstanceId));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "processInstanceIdWithChildren", processInstanceIdWithChildren));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "processDefinitionKey", processDefinitionKey));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "processDefinitionKeyLike", processDefinitionKeyLike));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "processDefinitionId", processDefinitionId));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "processDefinitionName", processDefinitionName));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "processDefinitionNameLike", processDefinitionNameLike));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "processBusinessKey", processBusinessKey));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "processBusinessKeyLike", processBusinessKeyLike));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "executionId", executionId));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "taskDefinitionKey", taskDefinitionKey));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "taskDefinitionKeys", taskDefinitionKeys));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "taskName", taskName));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "taskNameLike", taskNameLike));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "taskDescription", taskDescription));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "taskDescriptionLike", taskDescriptionLike));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "taskCategory", taskCategory));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "taskDeleteReason", taskDeleteReason));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "taskDeleteReasonLike", taskDeleteReasonLike));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "taskAssignee", taskAssignee));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "taskAssigneeLike", taskAssigneeLike));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "taskOwner", taskOwner));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "taskOwnerLike", taskOwnerLike));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "taskInvolvedUser", taskInvolvedUser));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "taskPriority", taskPriority));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "finished", finished));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "processFinished", processFinished));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "parentTaskId", parentTaskId));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "dueDate", dueDate));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "dueDateAfter", dueDateAfter));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "dueDateBefore", dueDateBefore));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "withoutDueDate", withoutDueDate));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "taskCompletedOn", taskCompletedOn));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "taskCompletedAfter", taskCompletedAfter));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "taskCompletedBefore", taskCompletedBefore));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "taskCreatedOn", taskCreatedOn));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "taskCreatedBefore", taskCreatedBefore));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "taskCreatedAfter", taskCreatedAfter));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "includeTaskLocalVariables", includeTaskLocalVariables));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "includeProcessVariables", includeProcessVariables));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "scopeDefinitionId", scopeDefinitionId));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "scopeId", scopeId));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "scopeType", scopeType));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "tenantId", tenantId));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "tenantIdLike", tenantIdLike));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "withoutTenantId", withoutTenantId));

        final String[] accepts = {
            "application/json"
        };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<DataResponseHistoricTaskInstanceResponse> returnType = new ParameterizedTypeReference<DataResponseHistoricTaskInstanceResponse>() {};
        return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * Query for historic task instances
     * All supported JSON parameter fields allowed are exactly the same as the parameters found for getting a collection of historic task instances, but passed in as JSON-body arguments rather than URL-parameters to allow for more advanced querying and preventing errors with request-uri’s that are too long. On top of that, the query allows for filtering based on process variables. The taskVariables and processVariables properties are JSON-arrays containing objects with the format as described here.
     * <p><b>200</b> - Indicates request was successful and the tasks are returned
     * <p><b>404</b> - Indicates an parameter was passed in the wrong format. The status-message contains additional information.
     * @param body The body parameter
     * @return DataResponseHistoricTaskInstanceResponse
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public DataResponseHistoricTaskInstanceResponse queryHistoricTaskInstance(HistoricTaskInstanceQueryRequest body) throws RestClientException {
        Object postBody = body;

        String path = UriComponentsBuilder.fromPath("/query/historic-task-instances").build().toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = {
            "application/json"
        };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<DataResponseHistoricTaskInstanceResponse> returnType = new ParameterizedTypeReference<DataResponseHistoricTaskInstanceResponse>() {};
        return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
}
